﻿// //  ********************************************************************************
// //  Copyright (C) 2016 Sebastian Kenter. All rights reserved.
// // 
// //  Name    : MultiServerEngine | ServerFramework | RealmCharacter.cs
// //  Created : 2016 - 02 - 16 20:53
// //  Modified: 2016 - 02 - 20 12:32
// //  ********************************************************************************

namespace ServerFramework.Implementation.Database.Domain
{
    public class RealmCharacter_T
    {
        public virtual int RealmId { get; set; }
        public virtual int AccountId { get; set; }
        public virtual int NumChars { get; set; }

        #region NHibernate Composite Key Requirements

        public override bool Equals(object obj)
        {
            RealmCharacter_T t = obj as RealmCharacter_T;
            if (t == null) return false;
            return RealmId == t.RealmId && AccountId == t.AccountId;
        }

        public override int GetHashCode()
        {
            int hash = GetType().GetHashCode();
            hash = (hash*397) ^ RealmId.GetHashCode();
            hash = (hash*397) ^ AccountId.GetHashCode();

            return hash;
        }

        #endregion
    }
}
